package com.dzjcloud.dzj.common.minio.vo;

import io.minio.ObjectStat;
import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.Date;
import java.util.List;
import java.util.Map;


/**
 * <p>
 * 存储对象的元数据
 * </p>
 *
 * @author 杨朝勇
 * @Version: V1.0
 * @since 2019-04-13 17:46
 */
@Data
@AllArgsConstructor
public class MinioObject {
    private String bucketName;
    private String name;
    private Date createdTime;
    private Long length;
    private String etag;
    private String contentType;
    private Map<String, List<String>> httpHeaders;

    public MinioObject(ObjectStat os) {
        this.bucketName = os.bucketName();
        this.name = os.name();
        this.createdTime = Date.from(os.createdTime().toInstant());

        this.length = os.length();
        this.etag = os.etag();
        this.contentType = os.contentType();
        this.httpHeaders = os.httpHeaders();
    }

}
